﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Thaire.Investment.Common
{
    public enum InstrumentType
    {
        None, FixedIncome, Equity, UnitTrust, Derivatives, Loans, DepositAtFinancial
    }
    public class CommonUtil
    {

        public static InstrumentType GetInstrumentType(string code)
        {
            if ("FIS" == code)
                return InstrumentType.FixedIncome;
            if ("UT" == code)
                return InstrumentType.UnitTrust;
            if ("ES" == code)
                return InstrumentType.Equity;
            if ("DEP" == code)
                return InstrumentType.DepositAtFinancial;
            return InstrumentType.None;
        }

        public static DateTime GetLastDayOfMonth(DateTime date)
        {
            return new DateTime(date.Year, date.Month, DateTime.DaysInMonth(date.Year, date.Month));
        }
    }
}
